﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RkLibs.Configuration;
using RkLibs.Functions;
using CustomErp.Model;
using CustomErp.Database;
namespace CustomErp
{
    partial class SoftwareManger
    {
        DbMgr dbMgr;
        /// <summary>
        /// 初始化全局变量
        /// </summary>
        private void InitGlobalValue()
        {
            gValue.SoftwareDataDir = string.Format("{0}\\{1}\\", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), gValue.SOFTWARE_NAME);
            CommonFunction.CreateDirectory(gValue.SoftwareDataDir);
            Cfg.Initialize(ConfigFileType.INI, gValue.SoftwareDataDir + gValue.SFT_CFG_FILE);

            gValue.LogDir = AppDomain.CurrentDomain.BaseDirectory + "Log\\";
            CommonFunction.CreateDirectory(gValue.LogDir);

            ItemInformation.LoadFieldInfo();



            if (!gValue.IsDbReady)
            {
                ShowFieldMgr();
            }
        }
        private void ReleaseGlobalValue()
        {
            ItemInformation.SaveFieldInfo();

            Cfg.Close();
        }
    }
}
